Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add template modes #40

Merged
merged 5 commits into from
Mar 29, 2024
Merged

Add template modes #40

merged 5 commits into from
Mar 29, 2024

Conversation

tuturu-tech
Copy link
Collaborator

This PR adds three different strategies for generating fuzzing harnesses via the template command. Related to #37

The three modes are:

  • simple - The fuzzing harness will be generated with all of the state-changing functions from the target contracts. All function calls are performed directly, with the harness contract as the msg.sender.
  • prank - Similar to simple mode, with the difference that function calls are made from different users by using hevm.prank(). The users can be defined in the configuration file as "actors": ["0xb4b3", "0xb0b", ...]
  • actor - Actor contracts will be generated and all harness function calls will be proxied through these contracts. The Actor contracts can be considered as users of the target contracts and the functions included in these actors can be filtered by modifier, external calls, or by payable. This allows for granular control over user capabilities.

Changes

  • Added a new CLI flag --mode to the template command. Added three modes: simple, prank, and actor
  • Updated the HarnessGenerator class to enable mode selection
  • Fixed harness test
  • Updated README
  • Updated template to import Hevm from properties

@tuturu-tech tuturu-tech merged commit 3a6bf68 into main Mar 29, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant